package com.ndp.fb.creative.fetchdata.dao.mysql.impl.mapper;

import com.ndp.fb.creative.fetchdata.dao.domain.AccountImage;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Component;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * Created by infi on 2014/10/25.
 */
@Component
public class AccountImagesRowMapper implements RowMapper<AccountImage> {
    @Override
    public AccountImage mapRow(ResultSet rs, int rowNum) throws SQLException {
        AccountImage accountImage = new AccountImage();

        accountImage.setId(rs.getLong("id"));
        accountImage.setUserId(rs.getString("user_id"));
        accountImage.setAccountId(rs.getString("account_id"));
        accountImage.setImageId(rs.getString("image_id"));
        accountImage.setUploadSatus(rs.getInt("upload_satus"));
        accountImage.setIsNeedUpload(rs.getInt("is_need_upload"));
        accountImage.setUploadCounts(rs.getInt("upload_counts"));
        accountImage.setUploadTime(rs.getTimestamp("upload_time"));
        accountImage.setHashCode(rs.getString("hash_code"));
        accountImage.setFbUrl(rs.getString("fb_url"));
        accountImage.setIsDelete(rs.getInt("is_delete"));
        accountImage.setName(rs.getString("name"));

        return accountImage;
    }
}
